package com.zyg.demo.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhengyunguang
 */
public class Plugin implements Serializable {


    public Plugin() {
    }

    public Plugin(int type) {
        this.type = type;
    }

    /**
     * 插件名字
     */
    public String name;
    /**
     * 插件icon
     */
    public ImageItem imageItem;

    /**
     * 插件icons
     */
    public List<ImageItem> imageItems;

    /**
     * 插件类型
     */
    public int type;

    /**
     * 自插件
     */
    public List<Plugin> plugins;

    /**
     * @see com.zyg.demo.util.Constants#DRAW_STATE_NORMAL
     * 当时文件夹时，绘画需要state标识
     */
    public int dragState;

    public void addPlugin(Plugin plugin) {
        if (plugins == null) {
            plugins = new ArrayList<>();
        }
        if (imageItems == null) {
            imageItems = new ArrayList<>();
        }
        plugins.add(plugin);
        imageItems.add(plugin.imageItem);
    }

    public void removePlugin(int position) {
        plugins.remove(position);
        imageItems.remove(position);
    }

    public void removeImageItems(int position) {
        imageItems.remove(position);
    }

}
